# Randomly selected passive option for conative attitudes outcome question

Passive_Option <- c("tutor","headmaster","wait","send")
lab$randomdraw6_grouped <- NA
lab$randomdraw6_grouped[lab$randomdraw6<.25] <-1
lab$randomdraw6_grouped[lab$randomdraw6>.25 & lab$randomdraw6<=.5] <-2
lab$randomdraw6_grouped[lab$randomdraw6>.5 & lab$randomdraw6<=.75] <-3
lab$randomdraw6_grouped[lab$randomdraw6>.75] <-4

lab$abs_passive_option <- NA
lab$abs_passive_option_lc1[lab$randomdraw6_grouped == 1] <- "tutor"
lab$abs_passive_option_lc1[lab$randomdraw6_grouped == 2] <- "wait"
lab$abs_passive_option_lc1[lab$randomdraw6_grouped == 3] <- "headmaster"
lab$abs_passive_option_lc1[lab$randomdraw6_grouped == 4] <- "send"
lab$abs_passive_option_bring_up[lab$randomdraw6_grouped == 1] <- "headmaster"
lab$abs_passive_option_bring_up[lab$randomdraw6_grouped == 2] <- "tutor"
lab$abs_passive_option_bring_up[lab$randomdraw6_grouped == 3] <- "send"
lab$abs_passive_option_bring_up[lab$randomdraw6_grouped == 4] <- "wait"
lab$abs_passive_option_pta[lab$randomdraw6_grouped == 1] <- "wait"
lab$abs_passive_option_pta[lab$randomdraw6_grouped == 2] <- "send"
lab$abs_passive_option_pta[lab$randomdraw6_grouped == 3] <- "tutor"
lab$abs_passive_option_pta[lab$randomdraw6_grouped == 4] <- "headmaster"
lab$abs_passive_option_assemble[lab$randomdraw6_grouped == 1] <- "send"
lab$abs_passive_option_assemble[lab$randomdraw6_grouped == 2] <- "headmaster"
lab$abs_passive_option_assemble[lab$randomdraw6_grouped == 3] <- "wait"
lab$abs_passive_option_assemble[lab$randomdraw6_grouped == 4] <- "tutor"


# sex_q2_1

# female
labcb$sex_q2_1
lab$female <- NA
lab$female[lab$sex_q2_1 == 2] <- 1
lab$female[lab$sex_q2_1 == 1] <- 0


# day_q2_2

sumna(lab$day_q2_2)
labcb$day_q2_2
lab$day <- lab$day_q2_2
lab$day[lab$day_q2_2 == 3] <- 0

# age_q2_3_c
lab$age <- lab$age_q2_3
lab$age[!is.na(lab$age_q2_3_c)] <- lab$age_q2_3_c[!is.na(lab$age_q2_3_c)]

# rel_q2_4
labcb$rel_q2_4
lab$household_head <- dummy_q("rel_q2_4",1, data = lab)
lab$household_spouse <- dummy_q("rel_q2_4",2, data = lab)
lab$household_other <- dummy_q("rel_q2_4",3:12, data = lab)

lab$married <- dummy_q("status_q2_5",1, data = lab)
lab$living_as_married <- dummy_q("status_q2_5",2, data = lab)
lab$not_married <- dummy_q("status_q2_5",c(3,7), data = lab)
lab$not_married[lab$q2_5_oth == "Not married "] <- 1
lab$separated <- dummy_q("status_q2_5",c(4,5,6), data = lab)
lab$separated[lab$q2_5_oth == "Widower"] <- 1
lab$married_or_living_as_married <- (lab$married == 1 | lab$living_as_married == 1)*1
lab$married_or_living_as_married[is.na(lab$status_q2_5)] <- NA


labcb$lc1_naba_vht_q2_11
lab$village_official <- (grepl("1|3|5|7|9", lab$lc1_naba_vht_q2_11, ignore.case = T) & 
												 	!grepl("10|11", lab$lc1_naba_vht_q2_11, ignore.case = T))*1
lab$village_official[is.na(lab$lc1_naba_vht_q2_11)] <- NA

lab$village_official_fam <- (grepl("2|4|6|8|10", lab$lc1_naba_vht_q2_11, ignore.case = T))*1
lab$village_official_fam[is.na(lab$lc1_naba_vht_q2_11)] <- NA

labcb$activity_q3_1
lab$agriculture_work <- dummy_q("activity_q3_1",c(1,19,3), data = lab)
lab$education_work <- dummy_q("activity_q3_1",c(16,17), data = lab)
lab$domestic_work <- dummy_q("activity_q3_1",c(12), data = lab)
lab$retail_work <- dummy_q("activity_q3_1",c(7), data = lab)
lab$transport_work <- dummy_q("activity_q3_1",c(13), data = lab)
lab$manual_work <- dummy_q("activity_q3_1",c(4,5,6,10,11), data = lab)
lab$hospitality_work <- dummy_q("activity_q3_1",c(8,9), data = lab)
lab$no_work <- dummy_q("activity_q3_1",14, data = lab)
lab$other_work <- dummy_q("activity_q3_1",c(15), data = lab)

# frequency_discussion
labcb$frequency_discussion_q3_1
lab$frequency_discussion <-  4 - lab$frequency_discussion_q3_1


# news consumption
labcb$news_q4_1
lab$news_consumption <- lab$news_q4_1 - 1 

# watch TV
labcb$watchTV_q4_1
lab$watching_tv <- lab$watchTV_q4_1 
lab$watching_tv[lab$watching_tv == 6] <- 0


# mobile_q4_2
labcb$mobile_q4_2
lab$mobile_phone_use <- lab$mobile_q4_2 - 1


## Other_person
labcb$person_q18_1
lab$other_person <- (lab$person_q18_1 == 1)*1
lab$other_person[is.na(lab$person_q18_1)] <- NA

## living_conditions_compared
labcb$observe_conditions_q18_4
lab$living_conditions_compared <- lab$observe_conditions_q18_4 - 1
lab$living_conditions_compared[lab$observe_conditions_q18_4 == 6] <- NA
















